home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / python2.4 / test / test_winsound.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2005-10-18  |  4KB  |  122 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.4)
  3.  
  4. import unittest
  5. from test import test_support
  6. import winsound
  7. import time
  8.  
  9. class BeepTest(unittest.TestCase):
  10.     
  11.     def test_errors(self):
  12.         self.assertRaises(TypeError, winsound.Beep)
  13.         self.assertRaises(ValueError, winsound.Beep, 36, 75)
  14.         self.assertRaises(ValueError, winsound.Beep, 32768, 75)
  15.  
  16.     
  17.     def test_extremes(self):
  18.         winsound.Beep(37, 75)
  19.         winsound.Beep(32767, 75)
  20.  
  21.     
  22.     def test_increasingfrequency(self):
  23.         for i in xrange(100, 2000, 100):
  24.             winsound.Beep(i, 75)
  25.         
  26.  
  27.  
  28.  
  29. class MessageBeepTest(unittest.TestCase):
  30.     
  31.     def tearDown(self):
  32.         time.sleep(0.5)
  33.  
  34.     
  35.     def test_default(self):
  36.         self.assertRaises(TypeError, winsound.MessageBeep, 'bad')
  37.         self.assertRaises(TypeError, winsound.MessageBeep, 42, 42)
  38.         winsound.MessageBeep()
  39.  
  40.     
  41.     def test_ok(self):
  42.         winsound.MessageBeep(winsound.MB_OK)
  43.  
  44.     
  45.     def test_asterisk(self):
  46.         winsound.MessageBeep(winsound.MB_ICONASTERISK)
  47.  
  48.     
  49.     def test_exclamation(self):
  50.         winsound.MessageBeep(winsound.MB_ICONEXCLAMATION)
  51.  
  52.     
  53.     def test_hand(self):
  54.         winsound.MessageBeep(winsound.MB_ICONHAND)
  55.  
  56.     
  57.     def test_question(self):
  58.         winsound.MessageBeep(winsound.MB_ICONQUESTION)
  59.  
  60.  
  61.  
  62. class PlaySoundTest(unittest.TestCase):
  63.     
  64.     def test_errors(self):
  65.         self.assertRaises(TypeError, winsound.PlaySound)
  66.         self.assertRaises(TypeError, winsound.PlaySound, 'bad', 'bad')
  67.         self.assertRaises(RuntimeError, winsound.PlaySound, 'none', winsound.SND_ASYNC | winsound.SND_MEMORY)
  68.  
  69.     
  70.     def test_alias_asterisk(self):
  71.         winsound.PlaySound('SystemAsterisk', winsound.SND_ALIAS)
  72.  
  73.     
  74.     def test_alias_exclamation(self):
  75.         winsound.PlaySound('SystemExclamation', winsound.SND_ALIAS)
  76.  
  77.     
  78.     def test_alias_exit(self):
  79.         winsound.PlaySound('SystemExit', winsound.SND_ALIAS)
  80.  
  81.     
  82.     def test_alias_hand(self):
  83.         winsound.PlaySound('SystemHand', winsound.SND_ALIAS)
  84.  
  85.     
  86.     def test_alias_question(self):
  87.         winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS)
  88.  
  89.     
  90.     def test_alias_fallback(self):
  91.         pass
  92.  
  93.     
  94.     def test_alias_nofallback(self):
  95.         
  96.         try:
  97.             winsound.PlaySound('!"$%&/(#+*', winsound.SND_ALIAS | winsound.SND_NODEFAULT)
  98.         except RuntimeError:
  99.             pass
  100.  
  101.  
  102.     
  103.     def test_stopasync(self):
  104.         winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS | winsound.SND_ASYNC | winsound.SND_LOOP)
  105.         time.sleep(0.5)
  106.         
  107.         try:
  108.             winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS | winsound.SND_NOSTOP)
  109.         except RuntimeError:
  110.             pass
  111.  
  112.         winsound.PlaySound(None, winsound.SND_PURGE)
  113.  
  114.  
  115.  
  116. def test_main():
  117.     test_support.run_unittest(BeepTest, MessageBeepTest, PlaySoundTest)
  118.  
  119. if __name__ == '__main__':
  120.     test_main()
  121.  
  122.